//
//  PrizeTableViewCell.m
//  happyHealthyWalk
//
//  Created by newhuidong on 16/2/25.
//  Copyright © 2016年 HuiDong. All rights reserved.
//



#import "PrizeTableViewCell.h"
#import "Prize.h"



@interface PrizeTableViewCell ()


@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *describe_lable;
@property (weak, nonatomic) IBOutlet UILabel *stepCount;

@property (weak, nonatomic) IBOutlet UIButton *buy_button;



@end


@implementation PrizeTableViewCell


-(void)setDic:(NSDictionary *)dic{
    _dic=dic;
    
    Prize* prize=[[Prize alloc]initWithDic:dic];
    
    
    self.image.image=[UIImage imageNamed:[NSString stringWithFormat:@"%@",prize.imageName]];
    self.describe_lable.text=prize.describe;
    self.stepCount.text=prize.step;
    
    
}

+(instancetype)prizecellWithTableView:(UITableView *)tableView{
    
    static NSString * identifer=@"PrizeTableViewCell";
    PrizeTableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:identifer];
    if (!cell) {
        
        cell=[[[NSBundle mainBundle]loadNibNamed:@"PrizeTableViewCell" owner:nil options:nil] firstObject];
        
    }
    cell.describe_lable.adjustsFontSizeToFitWidth=YES;
    
    return cell;
    
    
}


- (void)awakeFromNib {
    

    self.buy_button.layer.cornerRadius=4;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)buyNow:(id)sender {
    
    if (self.customDelegate!=nil&&[self.customDelegate respondsToSelector:@selector(someproMethod:)]) {
        
        [self.customDelegate someproMethod:_cellRow];
        
    }
    
    
}

@end
